home *** CD-ROM | disk | FTP | other *** search
/ MacHack 2000 / MacHack 2000.toast / pc / The Hacks / DockStrip / MoreSetup.h < prev    next >
Encoding:
C/C++ Source or Header  |  2000-06-24  |  3.7 KB  |  107 lines

  1. /*
  2.     File:        MoreSetup.h
  3.  
  4.     Contains:    Sets up conditions etc for MoreIsBetter.
  5.  
  6.     Written by:    Pete Gontier (PCG)
  7.  
  8.     Copyright:    Copyright © 1998 by Apple Computer, Inc., All Rights Reserved.
  9.  
  10.                 You may incorporate this Apple sample source code into your program(s) without
  11.                 restriction. This Apple sample source code has been provided "AS IS" and the
  12.                 responsibility for its operation is yours. You are not permitted to redistribute
  13.                 this Apple sample source code as "Apple sample source code" after having made
  14.                 changes. If you're going to re-distribute the source, we require that you make
  15.                 it clear in the source that the code was descended from Apple sample source
  16.                 code, but that you've made changes.
  17.  
  18.     Change History (most recent first):
  19.  
  20.          <7>     22/4/99    Quinn   Add a check for the Universal Interfaces version.  MoreIsBetter
  21.                                     requires Universal Interfaces 3.2 or higher (because many of its
  22.                                     component parts do).
  23.          <6>     2/11/99    PCG     add comments because Andy rightfully pointed out my original
  24.                                     attempts sucked; also, remove some excessive TARGET_CARBON
  25.                                     gymnastics
  26.          <5>     1/22/99    PCG     TARGET_CARBON
  27.          <4>    11/11/98    PCG     fix header
  28.          <3>    11/10/98    PCG     separate change histories
  29.          <2>    10/11/98    Quinn   Convert "MorePrefix.h" to "MoreSetup.h".
  30.          <1>    10/11/98    Quinn   Changed name from "MorePrefix.h" to "MoreSetup.h".
  31.  
  32.     Start of "MorePrefix.h" change history (most recent first):
  33.  
  34.          <3>     5/11/98    Quinn   Use MoreAssertQ instead of MoreAssert.
  35.          <2>     7/24/98    PCG        rid of triplet #includes
  36.          <2>     6/23/98    PCG     add copyright disclaimer stuff
  37.          <1>     6/23/98    PCG     initial checkin
  38. */
  39.  
  40. #pragma once
  41.  
  42.     //
  43.     //    We never want to use old names or locations.
  44.     //    Since these settings must be consistent all the way through
  45.     //    a compilation unit, and since we don't want to silently
  46.     //    change them out from under a developer who uses a prefix
  47.     //    file (C/C++ panel of Target Settings), we simply complain
  48.     //    if they are already set in a way we don't like.
  49.     //
  50.  
  51. #ifndef OLDROUTINELOCATIONS
  52. #    define OLDROUTINELOCATIONS 0
  53. #elif OLDROUTINELOCATIONS
  54. #    error OLDROUTINELOCATIONS must be FALSE when compiling MoreIsBetter.
  55. #endif
  56.  
  57. #ifndef OLDROUTINENAMES
  58. #    define OLDROUTINENAMES 0
  59. #elif OLDROUTINENAMES
  60. #    error OLDROUTINENAMES must be FALSE when compiling MoreIsBetter.
  61. #endif
  62.  
  63.     //
  64.     //    Almost every non-trivial module needs to detect
  65.     //    or produce errors, so we include it for the
  66.     //    convenience of all modules.
  67.     //
  68.  
  69. #include <Errors.h>
  70.  
  71.     //    Now that we've included a Mac OS interface file,
  72.     //    we know that the Universal Interfaces environment
  73.     //    is set up.  MoreIsBetter requires Universal Interfaces
  74.     //    3.2 or higher.  Check for it.
  75.  
  76. #if !defined(UNIVERSAL_INTERFACES_VERSION) || UNIVERSAL_INTERFACES_VERSION < 0x0320
  77.     #error MoreIsBetter requires Universal Interfaces 3.2 or higher.
  78. #endif
  79.  
  80.     //
  81.     //    We usually want asserions and other debugging code
  82.     //    turned on, but you can turn it all off if you like
  83.     //    by setting MORE_DEBUG to 0.
  84.     //
  85.  
  86. #ifndef MORE_DEBUG
  87. #    define MORE_DEBUG 1
  88. #endif
  89.  
  90.     //
  91.     //    Our assertion macros compile down to nothing if
  92.     //    MORE_DEBUG is not true. MoreAssert produces a
  93.     //    value indicating whether the assertion succeeded
  94.     //    or failed. MoreAssertQ is Quinn's flavor of
  95.     //    MoreAssert which does not produce a value.
  96.     //
  97.  
  98. #if MORE_DEBUG
  99. #    define MoreAssert(x) \
  100.         ((x) ? true : (DebugStr ("\pMoreAssert failure: " #x), false))
  101. #    define MoreAssertQ(x) \
  102.         do { if (!(x)) DebugStr ("\pMoreAssertQ failure: " #x); } while (false)
  103. #else
  104. #    define MoreAssert(x) (true)
  105. #    define MoreAssertQ(x)
  106. #endif
  107.